﻿using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using System.Net.Mail;



namespace ClsManagment.ManagmentHelper
{
    class FaxingHelper
    {

        private String servidorSMTP;
        private String subject;
        private String content;

        private String dirAttachment;
        private String fromAddr;
        private String toAddr;

        private ArrayList dirAttachmentMultiple;
        private ArrayList fromAddressMultiple;
        private ArrayList toAddressMultiple;

        private MailMessage mail;
        private SmtpClient SmtpServer;

        public void crearCorreo()
        {
            MailMessage mail = new MailMessage();
            SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
            mail.From = new MailAddress("your_email_address@gmail.com");
            mail.To.Add("to_address");
            mail.Subject = "Test Mail - 1";
            mail.Body = "mail with attachment";

            System.Net.Mail.Attachment attachment;
            attachment = new System.Net.Mail.Attachment("you attachment file");
            mail.Attachments.Add(attachment);

            SmtpServer.Port = 587;
            SmtpServer.Credentials = new System.Net.NetworkCredential("username", "password");
            SmtpServer.EnableSsl = true;

            SmtpServer.Send(mail);
        
        }

        private void inicializarConfiguracion()
        {
            MailMessage mail = new MailMessage();
            SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
            mail.From = new MailAddress("your_email_address@gmail.com");
            mail.To.Add("to_address");
            mail.Subject = "Test Mail - 1";
            mail.Body = "mail with attachment";

            System.Net.Mail.Attachment attachment;
            attachment = new System.Net.Mail.Attachment("you attachment file");
            mail.Attachments.Add(attachment);

            SmtpServer.Port = 587;
            SmtpServer.Credentials = new System.Net.NetworkCredential("username", "password");
            SmtpServer.EnableSsl = true;

            SmtpServer.Send(mail);

        }

        public void agregaDireccionTo(String dir)
        {
            toAddressMultiple.Add(dir);
        }

        public void agregaDireccionesTo(ArrayList listadoDir) 
        {
            toAddressMultiple = listadoDir;
        }
        
        public void agregaDireccionFrom(String dir) 
        {
            fromAddressMultiple.Add(dir);
        }

        public void agregaDireccionFrom(ArrayList listadoDir) 
        {
            fromAddressMultiple = listadoDir;
        }

        public void agregaAdjuntos(String adjunti) 
        {
            dirAttachmentMultiple.Add(adjunti);
        }

        public void agregaAdjuntos(ArrayList listadoAdjuntos) 
        {
            dirAttachmentMultiple = listadoAdjuntos;
        }

    }
}
